package com.gopay.scheduler.service.reporthandler.impl;

import java.util.List;
import java.util.concurrent.CountDownLatch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gopay.common.datasource.DBType;
import com.gopay.common.datasource.DbContextHolder;
import com.gopay.cron.service.trans.ReportConsoleTransQueryService;
import com.gopay.cron.web.vo.TransQueryResultVO;

public class UpdateReportConsoleTransQueryTask implements Runnable{
	 private Logger logger = LoggerFactory.getLogger(this.getClass());
	 
	 private ReportConsoleTransQueryService reportConsoleTransQueryService;
	    private  List<TransQueryResultVO> sublist;
	    private CountDownLatch latch;
	@Override
	public void run() {
		try{
			DbContextHolder.setDbType(DBType.DS_REPORT.value);
			reportConsoleTransQueryService.saveOrUpdateTransQueryResultList(sublist);
		}catch(Exception e){
			logger.error("更新报表库出错",e);
		}finally{
			latch.countDown();
		}
		
	}
	public UpdateReportConsoleTransQueryTask(
			ReportConsoleTransQueryService reportConsoleTransQueryService,
			List<TransQueryResultVO> sublist, CountDownLatch latch) {
		super();
		this.reportConsoleTransQueryService = reportConsoleTransQueryService;
		this.sublist = sublist;
		this.latch = latch;
	}
	
	

}
